package com.panopset.refactorsf;

import static com.panopset.Util.x;
import static com.panopset.UtilIO.mkdirs;

import java.awt.LayoutManager;

import javax.swing.JFileChooser;

import com.panopset.sf.Windoc;

/**
 * Directory path persistent container.
 *
 * @author Karl Dinwiddie
 *
 */
public class PanDirectory extends AbstractPanFile {

    /**
     * @param borderTitle
     *            Border title.
     * @param toolTipText
     *            Tool tip text.
     */
    public PanDirectory(final Windoc wd, final String borderTitle, final String toolTipText) {
        this(wd, borderTitle, toolTipText, "");
    }

    /**
     *
     * @param borderTitle
     *            Border title.
     * @param toolTipText
     *            Tool tip text.
     * @param defaultValue
     *            Default value.
     */
    public PanDirectory(final Windoc wd, final String borderTitle, final String toolTipText,
            final String defaultValue) {
        super(wd, borderTitle, toolTipText, defaultValue);
    }

    @Override
    protected String createPrompter() {
        return x("directory");
    }

    @Override
    protected int getFileSelectionMode() {
        return JFileChooser.DIRECTORIES_ONLY;
    }

    @Override
    protected void create() {
        mkdirs(getFile());
    }

    @Override
    protected LayoutManager createLayout() {
        return null;
    }

    @Override
    protected boolean isValid(final String valueToCheck) {
        return true;
    }

	public String getValue() {
		return getGuiValue();
	}
}
